<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>统计成绩最大值和最小值</title>
    </head>
    <body>
        <script>
            var arr = [];  
            var sum = 0;
            var max = -Infinity;
            var min = Infinity; 
            for (var i = 0; i < 5; i++) { 
                var score = parseInt(prompt("请输入第" + (i+1) + "门成绩：")); 
                arr.push(score);
                sum += score;
                if (score > max) { 
                    max = score; 
                } 
                if (score < min) { 
                    min = score; 
                } 
            }
            var average = sum / 5; 
            document.write("5门成绩分别是："+arr[0]+","+arr[1]+","+arr[2]+","+arr[3]+","+arr[4] + "<br>");
            document.write("总分是：" + sum + "<br>");
            document.write("平均分：" + average + "<br>");
            document.write("最高分：" + max + "<br>");
            document.write("最低分：" + min + "<br>");
        </script>
    </body>
    </html>